package com.itboye.lottery.adapter;

import android.content.Context;
import android.view.ViewGroup;

import com.itboye.lottery.R;
import com.itboye.lottery.adapter.base.ViewHolerAdapter;
import com.itboye.lottery.adapter.holder.MyLotteryPopHolder;


/**
 * Created by zd on 2017/5/9.
 */

public class MyLotteryPopAdapter extends ViewHolerAdapter<MyLotteryPopHolder> {
    private Context mContext;
    private String[] arr;
    private String[] types;
    private int pager = 0;

    public MyLotteryPopAdapter(Context ctxt, String[] arr, String[] types, int pager) {
        this.mContext = ctxt;
        this.arr = arr;
        this.types = types;
        this.pager = pager;
    }

    @Override
    public MyLotteryPopHolder onCreateViewHolder(int position, ViewGroup parent) {
        return new MyLotteryPopHolder(mContext, R.layout.fragment_hemai_popuwindow_item);
    }

    @Override
    public void onBindViewHolder(int position, MyLotteryPopHolder myLotteryPopHolder) {
        String name = arr[position];
        String type = types[position];
        myLotteryPopHolder.init(name,type,position == pager);
    }

    @Override
    public int getCount() {
        return arr.length;
    }

    public void setPager(int pager){
        this.pager = pager;
        notifyDataSetChanged();
    }
}
